import types from '@/store/constants/types'

import echarts from '@/lib/echarts'
export default {
    
    [types.MAP_GET_JSON_FILE] (context, amount) { //获取地图json
        //amount: { map: '地图名称', file: '文件名称', api:  }
        
        let url =  process.env.NODE_ENV === 'production'?`/json/${amount.api}.json`:`/json/${amount.api}.json`;
        this.dispatch( 'ajax', url).then((data) => {
            if(data) {
                echarts.registerMap(amount.name, data)
                context.commit( types.MAP_SET_REGION_NAME, amount.name )
            }
        })
    },
}